Skip to content

Use static imports for Assertions.assertThat() consistently#48630

Closed
izeye wants to merge 1 commit into
spring-projects:mainfrom
izeye:assert-that
Closed

Use static imports for Assertions.assertThat() consistently#48630
izeye wants to merge 1 commit into
spring-projects:mainfrom
izeye:assert-that

Conversation

@izeye

@izeye izeye commented Dec 28, 2025

Copy link
Copy Markdown
Contributor

This PR changes to use static imports for Assertions.assertThat() consistently where possible.

Signed-off-by: Johnny Lim <izeye@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 28, 2025

@snicoll snicoll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. We are not using the static import in assert implementations (main code). I think we should keep it this way. WDYT?

@izeye

izeye commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

@snicoll Thanks for the feedback!

I don't have a strong opinion on it. I just thought that it's prefered based on the following changes: 90faddf#diff-e9d603edb2e72b3fc962233b6ae08d6391b61bb776bc86ce2039df7860f05866R233

@snicoll

snicoll commented Dec 29, 2025

Copy link
Copy Markdown
Member

Good point, I remember reviewing this and then going with it as the OP is an AssertJ maintainer but I think we may want to reconsider this. I'll flag for team attention to get more feedback.

@snicoll snicoll added for: team-attention An issue we'd like other members of the team to review type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 29, 2025
@snicoll snicoll added this to the 3.5.x milestone Dec 29, 2025
@Pankraz76

This comment was marked as resolved.

Pankraz76 pushed a commit to Pankraz76/spring-boot that referenced this pull request Dec 29, 2025
Signed-off-by: Vincent Potucek <vpotucek@me.com>
@Pankraz76 Pankraz76 mentioned this pull request Jan 4, 2026
@Pankraz76

This comment was marked as resolved.

@wilkinsona

Copy link
Copy Markdown
Member

I don't feel particularly strongly about it, but I lean towards consistently using the static import in both main and test code.

Pankraz76 pushed a commit to Pankraz76/spring-boot that referenced this pull request Jan 5, 2026
Signed-off-by: Vincent Potucek <vpotucek@me.com>
@philwebb

philwebb commented Jan 5, 2026

Copy link
Copy Markdown
Member

I don't have a strong opinion in either direction.

@snicoll

snicoll commented Jan 5, 2026

Copy link
Copy Markdown
Member

Cool, thanks both. Let's go with the consistent option to use the static import then.

@snicoll snicoll removed the for: team-attention An issue we'd like other members of the team to review label Jan 5, 2026
@snicoll snicoll self-assigned this Jan 5, 2026
snicoll pushed a commit that referenced this pull request Jan 6, 2026
See gh-48630

Signed-off-by: Johnny Lim <izeye@naver.com>
@snicoll snicoll closed this in c10cf59 Jan 6, 2026
@snicoll snicoll modified the milestones: 3.5.x, 3.5.10 Jan 6, 2026
@izeye izeye deleted the assert-that branch January 6, 2026 12:51
@Pankraz76

Copy link
Copy Markdown

Cool, thanks both. Let's go with the consistent option to use the static import then.

Does this mean the rule? It reads like so because consistency can only be achieved via some gatekeeper, which is currently not the case, as discovered in:

philwebb added a commit that referenced this pull request Jan 6, 2026
Add a rule to ensure we consistently use `assertThat` rather than
`Assertions.assertThat`.

See gh-48630
@philwebb

philwebb commented Jan 6, 2026

Copy link
Copy Markdown
Member

@Pankraz76 Good idea, I've added a rule in 92263e7

philwebb added a commit that referenced this pull request Jan 6, 2026
@Pankraz76

Copy link
Copy Markdown

ah nice thx, yes check also capable of doing, so we having all parties happy.

Got some gate keeper and no new tool.

well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants